
//
//  UIButton+move.m
//  Life assistant
//
//  Created by HYMac on 16/2/26.
//  Copyright © 2016年 HY. All rights reserved.
//

#import "UIButton+move.h"
#import <objc/runtime.h>

@implementation UIButton (move)
static char BtnX;
static char BtnY;
static char BtnVX;
static char BtnVY;
static char btnDirectionXY;
static char btnColo;
static char btnT;
-(void)setX:(CGFloat)x
{
    objc_setAssociatedObject(self, &BtnX, [NSString stringWithFormat:@"%f",x] , OBJC_ASSOCIATION_ASSIGN);
}
- (CGFloat)x
{
    return [objc_getAssociatedObject(self, &BtnX) floatValue];
}
-(void)setY:(CGFloat)y
{
    objc_setAssociatedObject(self, &BtnY, [NSString stringWithFormat:@"%f",y], OBJC_ASSOCIATION_ASSIGN);
}
-(CGFloat)y
{
     return [objc_getAssociatedObject(self, &BtnY) floatValue];
}
-(void)setXV:(CGFloat)xV
{
    objc_setAssociatedObject(self, &BtnVX, [NSString stringWithFormat:@"%f",xV], OBJC_ASSOCIATION_ASSIGN);
}
-(CGFloat)xV
{
    NSLog(@"dxhdtrjx:%c",BtnVX);
    return   [objc_getAssociatedObject(self, &BtnVX) floatValue];
}
-(void)setYV:(CGFloat)yV
{
    objc_setAssociatedObject(self, &BtnVY, [NSString stringWithFormat:@"%f",yV], OBJC_ASSOCIATION_ASSIGN);
}
-(CGFloat)yV
{
    return  [objc_getAssociatedObject(self, &BtnVY) floatValue] ;
}
-(void)setDerectionXY:(CGFloat)derectionXY
{
    objc_setAssociatedObject(self, &btnDirectionXY, [NSString stringWithFormat:@"%f",derectionXY], OBJC_ASSOCIATION_ASSIGN);
}
-(CGFloat)derectionXY
{
    return [objc_getAssociatedObject(self, &btnDirectionXY) floatValue];
}
-(void)setColor:(btnColor)color
{
    objc_setAssociatedObject(self, &btnColo, [NSString stringWithFormat:@"%d",color], OBJC_ASSOCIATION_ASSIGN);
}
-(btnColor)color
{
   return [objc_getAssociatedObject(self, &btnColo)intValue];
}
-(void)setBtnTag:(NSInteger)btnTag
{
    objc_setAssociatedObject(self, &btnT, [NSString stringWithFormat:@"%ld",btnTag], OBJC_ASSOCIATION_ASSIGN);
}
-(NSInteger)btnTag
{
    return [objc_getAssociatedObject(self, &btnT)integerValue];
}
@end
